{extend name="admin@public/layout/popup"}

{block name="body"}
<div class="search-form-page-tab-content" id="search-form" style="display:none;">
    <div class="layui-form layui-card-header" style="height:auto;padding:0;">
        <form class="layui-form-item layui-form-pane" style="margin-bottom:0px;">
            <div class="layui-inline" style="padding-left: 10px;">
                <label class="layui-form-label" title="用户名">用户名</label>
                <div class="layui-input-inline">
                    <input type="text" name="search_param[username][value]" placeholder="请输入用户名" class="layui-input">
                    <input type="hidden" name="search_param[username][condition]" value="LIKE">
                </div>
            </div>

            <div class="layui-inline" style="padding-left: 10px;">
                <label class="layui-form-label" title="用户名">昵称</label>
                <div class="layui-input-inline">
                    <input type="text" name="search_param[nickname][value]" placeholder="请输入昵称" class="layui-input">
                    <input type="hidden" name="search_param[nickname][condition]" value="LIKE">
                </div>
            </div>

            <div class="layui-inline" style="padding-left: 10px;">
                <label class="layui-form-label" title="是否为超管">是否为超管</label>
                <div class="layui-input-inline">
                    <select name="search_param[is_super_manager][value]" placeholder="请输入是否为超管">
                        <option value=""></option>
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                    <input type="hidden" name="search_param[is_super_manager][condition]" value="=">
                </div>
            </div>

            <div class="layui-inline" style="padding-left: 10px;">
                <label class="layui-form-label" title="是否为超管">账号状态</label>
                <div class="layui-input-inline">
                    <select name="search_param[status][value]" placeholder="请输入账号状态">
                        <option value=""></option>
                        <option value="0">冻结</option>
                        <option value="1">正常</option>
                    </select>
                    <input type="hidden" name="search_param[status][condition]" value="=">
                </div>
            </div>

            <div class="layui-inline" style="padding-left: 10px;">
                <label class="layui-form-label" title="创建时间">创建时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" name="search_param[create_time][value]" id="create_time" laydate="true" laydate_type="datetime" laydate_range="true" placeholder="请选择时间">
                    <input type="hidden" name="search_param[create_time][condition]" value="BETWEEN">
                </div>
            </div>

            <div class="layui-inline" style="padding-left: 10px;">
                <button class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="laytp"><i class="layui-icon"></i> 搜 索</button>
            </div>
        </form>
    </div>
</div>
<table class="laytp-table layui-hide-sm" lay-filter="default"></table>
{/block}

{block name="script"}
<script>
layui.use(['layTp'],function() {
    const
        func_controller = {}
        ,layTp = layui.layTp
        ,$ = layui.jquery
    ;

    //批量操作渲染
    layui.dropdown.render({
        elem: '.action-more',
        options: [
            {
                action: "renew"
                ,title: "还原"
                ,icon: "layui-icon-list"
                ,uri: layTp.facade.url(module + "/" + controller + "/renew")
                ,switch_type: "confirm_action"
            }
            ,{
                action: 'true_del',
                title: '彻底删除'
                ,icon: "layui-icon-delete"
                ,uri: layTp.facade.url(module + "/" + controller + "/true_del")
                ,switch_type: "confirm_action"
            }
        ]
    });

    //表格渲染
    func_controller.table_render = function (where) {
        layui.table.render({
            elem: '.layui-hide-sm'
            , id: table_id
            , url: window.location.href
            , toolbar: '#default_toolbar'
            , where: where
            , even: true
            , method: 'GET'
            , cellMinWidth: 80
            , page: true
            , cols: [[
                {type:'checkbox'}
                ,{field:'id',title:'ID',align:'center',width:80}
                ,{field:'username',title:'用户名',align:'center'}
                ,{field:'nickname',title:'昵称',align:'center'}
                ,{field:'avatar',title:'头像',align:'center',templet:function(d){
                        return layTp.facade.formatter.images(d.avatar);
                    }}
                ,{field:'is_super_manager',title:'是否为超管',align:'center',templet:function(d){
                        return layTp.facade.formatter.status('is_super_manager',d.is_super_manager,["否","是"]);
                    }}
                ,{field:'status',title:'账号状态',align:'center',templet:function(d){
                        return layTp.facade.formatter.status('status',d.status,["冻结","正常"]);
                    }}
                ,{field:'create_time',title:'创建时间',align:'center',width:180}
                ,{field:'operation',title:'操作',align:'center',toolbar:'#operation',width:100}
            ]]
        });

        //监听默认工具条
        layui.table.on('tool(default)', function(obj){
            if(default_table_tool.indexOf(obj.event) != -1){
                layTp.facade.table_tool(obj);
            }else{
                //新增的其他操作按钮在这里来写
                //switch(obj.event){
                //    case '':
                //
                //        break;
                //}
            }
        });
    }

    func_controller.table_render();

    window.func_controller = func_controller;
});
</script>
{/block}

{block name="js_template"}
<script type="text/html" id="operation">
    <div class="layui-btn-group">
        <a class="layui-btn layui-btn-primary layui-btn-sm layui-icon layui-icon-list" lay-event="renew" title="还原" layer-tips="还原"> </a>
        <a class="layui-btn layui-btn-primary layui-btn-sm layui-icon layui-icon-delete" lay-event="true_del" title="彻底删除" layer-tips="彻底删除" colour="#f51c1c"> </a>
    </div>
</script>
<script type="text/html" id="default_toolbar">
    <div class="layui-table-tool-temp">
        <div class="layui-btn-group fl">
            <a href="javascript:void(0);" class="layui-btn layui-btn-primary layui-btn-sm layui-icon layui-icon-list action-more">&nbsp;批量操作</a>
            <a href="javascript:void(0);" class="layui-btn layui-btn-primary layui-btn-sm show-hidden-search-form layui-icon layui-icon-search">&nbsp;筛选</a>
        </div>
    </div>
</script>
{/block}